﻿using System;
using System.Windows.Forms;

namespace CrawlerApp
{
    public partial class Form1 : Form
    {
        private Crawler crawler;

        public Form1()
        {
            InitializeComponent();
            crawler = new Crawler(this);
            this.btnStart.Click += new EventHandler(btnStart_Click);
        }

        public ListBox ListUrls
        {
            get { return listUrls; }
        }

        public ListBox ListErrors
        {
            get { return listErrors; }
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            ListUrls.Items.Clear();
            ListErrors.Items.Clear();
            if (!string.IsNullOrEmpty(txtUrl.Text))
            {
                crawler.InitCrawl(txtUrl.Text.Trim());
            }
        }
    }
}
